In a computer system, the ability to control the allocation of memory resources is vital to the successful operation and scalability of the computer system as a whole. Software applications run more efficiently in environments in which steps are taken to proactively manage available memory resources to ensure that only those entities that are currently being used are stored in memory, while little-used entities are cleanly removed. Such memory management techniques have commonly been applied to object management, including the Java language, and other object-oriented environments. Many memory management techniques can be designed to be automatic, or to allow a developer control over the allocation. Java and other dynamic program languages include an automatic memory management. This means that the programmer need not keep an account of those parts of the memory that are used. The virtual machine carries out a so-called garbage collection from time to time, meaning, in principle, that the virtual machine scans the entire memory and finds which objects have been stored in the memory and which objects the program can no longer address. These parts of the memory are returned for later use.
Java also includes a built-in thread management system for supporting or simulating the simultaneous processing of two or more processes/activities. The thread management system is responsible for allocating memory resources to each thread, and deciding which threads shall be run, and which threads shall be made passive.
However, in order to further increase effectiveness and place occupied memory space at the disposal of the program, it is not sufficient to solely optimize the memory with respect to the objects. Additional mechanisms are required when the program includes many methods, to better optimize the arrangement of methods within the memory space.